//将来整个项目接口都在这里书写统一管理
//项目任何地方发请求:必然会用到二次封装axios
import requests from '@/utils/request'; //获取学校真实服务器axios
import mockRequest from '@/api/mockRequest';//获取模拟数据axios
//商品分类的接口
//函数:复用,声明一次，可以多次调用
//axios写法有两种:函数写法  对象
export const reqCategory = () => requests({ url: '/product/getBaseCategoryList', method: "get" });
//首页轮播图接口
export const reqBanner = () => mockRequest({ url: '/banner', method: 'get' });
//首页floor组件接口
export const reqFloor = () => mockRequest({ url: '/floor', method: 'get' });
//搜索接口
export const reqSearchList = (data) => requests({ url: '/list', method: 'post', data });
//获取商品详情接口
export const reqDetailList = (skuId) => requests({ url: `/item/${skuId}`, method: 'get' });

//加入购物车与修改商品个数的接口
export const reqAddCartOrUpdateSkuNum = (skuId, skuNum) => requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'post' })

//获取用户购物车的数据
export const reqUserCartList = () => requests({ url: `/cart/cartList`, method: 'get' });
//修改商品的勾选的状态
export const reqGoodCheckedState = (skuId, isChecked) => requests({ url: `/cart/checkCart/${skuId}/${isChecked}`, method: 'get' });

//删除某一个商品
export const reqDeleteGood = (skuId) => requests({ url: `/cart/deleteCart/${skuId}`, method: 'delete' });

//获取验证码
export const reqGetCode = (phone)=>requests({url:`/user/passport/sendCode/${phone}`,method:'get'});


//注册用户的接口
export const reqRegister = (data)=>requests({url:`/user/passport/register`,method:'post',data});


//登录接口
export const reqLogin = (data)=>requests({url:`/user/passport/login`,method:'post',data});

//获取用户信息的请求
export const reqUserInfo = ()=>requests({url:'/user/passport/auth/getUserInfo',method:'get'});

//退出登录
export const reqLogOut = ()=> requests({url:`/user/passport/logout`,method:'get'});


//获取交易页信息
export const reqTradeInfo = ()=>requests({url:`/order/auth/trade`,method:'get'});


//提交订单的接口
export const reqSubmit  = (tradeNo,data)=>requests({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,data,method:'post'});


//获取支付相关的信息【携带订单号:查询支付信息】
export const reqPayInfo = (orderId)=>requests({url:`/payment/weixin/createNative/${orderId}`,method:'get'});


//查询用户支付状态
export const reqPayStatus = (orderId)=>requests({url:`/payment/weixin/queryPayStatus/${orderId}`,method:'get'});


//我的订单
export const reqMyOrder = (page,limit)=>requests({url:`/order/auth/${page}/${limit}`,method:'get'});